What I learnt about (programming) languages by building bilingual websites

Rosemary Walmsley

Mae adeiladu gwefannau amlieithog yn wych. Dych chi’n dysgu llawer.

Building multilingual websites is great. You learn a lot.

What I’ve built bilingually

  • An evidence maps application (work)
    • Tech stack: Django framework in Python. GitHub. Azure.
    • User needs: Access evidence maps content bilingually in Welsh and English, in line with Welsh Language Standards. Interactive functionality, such as filtering, supported.
  • A wedding website (personal!)
    • Tech stack: Quarto. GitHub. Netlify.
    • User needs: English-only and French-only speakers able to access required information. High level of sophistication not required.

An image of a webpage in Welsh, showing an evidence map on interventions to improve uptake of adult vaccination.

Image source: https://phw-evidence-maps.azurewebsites.net

An image of a webpage in English, showing an evidence map on interventions to improve uptake of adult vaccination.

Image source: https://phw-evidence-maps.azurewebsites.net

An image of a webpage in English describing an invitation to a wedding, with details obscured.

An image of a webpage in French describing an invitation to a wedding, with details obscured.

The image is a hand-drawn comic titled 'take on hard projects.' It discusses self-doubt and confidence in tackling difficult tasks. The comic begins with a character thinking, 'I'm not sure, maybe someone better than me should work on this,' imagining an idealised 'magical' person for the job. This 'perfect' person is illustrated with qualities like 'codes really fast,' 'understands the business well,' 'knows everything about every technology,' 'great communicator,' 'has time for the project,' and '20 years of experience.'The comic points out that in programming technology is constantly changing, every project is different and often unclear, experts are few, and they can't do everything. Instead of waiting for a perfect candidate, the character decides to take on the project themselves. They recognise their strengths, like learning fast, working hard, having six years of experience, and being good at debugging. The character’s approach is to 'figure 'someone's gotta do this,' write down a plan, and get started!'' Often, this leads to learning something new and feeling 'a little more like a wizard.'

Image credit: Julia Evans, https://wizardzines.com/zines/wizard/

Vocabulary

  • internationalisation - i18n: designing an application to be adaptable to different languages or regions

  • localisation - l10n: adapting internationalised software to particular region or language

What I learnt

  • Don’t repeat yourself
  • Separating concerns
  • Human languages are full of interesting complexity
  • Reuse existing solutions
  • Not one right way
  • Not just a tech problem

Don’t repeat yourself

“Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.”

Andy Hunt and Dave Thomas, The Pragmatic Programmer

Separating concerns: content and functionality

  • Separation of concerns: A design principle that computer programs should be separated into sections that do one thing
  • Often about modularising a system
  • In this case, text content and functionality

Human languages are full of interesting complexity

get_pet_message <- function(pet, number_of_pets){
    plural_string <- ifelse(number_of_pets == 1, "", "s")
    pet_message <- paste0("You have ", number_of_pets,  " ", pet, plural_string)
    return(pet_message)   
}

Human languages are full of interesting complexity

get_pet_message <- function(pet, number_of_pets){
    plural_string <- ifelse(number_of_pets == 1, "", "s")
    pet_message <- paste0("You have ", number_of_pets,  " ", pet, plural_string)
    return(pet_message)   
}
get_pet_message("cat", 2)
[1] "You have 2 cats"
get_pet_message("dog", 1)
[1] "You have 1 dog"

Human languages are full of interesting complexity

An image of a whiteboard listing how to count dogs (ci) and cats (cath) in Welsh, showing that the words change their first letters for many of the numbers 1 to 6.

Image source: A photograph of the whiteboard in my Welsh class.

Reuse existing solutions

An image of the Django pages on internationalization.

Image source: https://docs.djangoproject.com/en/5.1/topics/i18n/

Reuse existing solutions

An image of the documentation for Python's gettext module.

Image source: https://docs.python.org/3/library/gettext.html

An image of documentation for the GNU gettext utility.

Image source: https://www.gnu.org/software/gettext/

Reuse existing solutions

An image of a blog about how to make a multilingual Quarto site.

Image source: https://marioangst.com/en/blog/posts/multi-language-quarto/#quarto-project-profiles

What I learnt

  • Don’t repeat yourself
  • Separating concerns
  • Human languages are full of interesting complexity
  • Reuse existing solutions
  • Not one right way
  • Not just a tech problem

Mae adeiladu gwefannau amlieithog yn wych. Dych chi’n dysgu llawer.

Building multilingual websites is great. You learn a lot.

Can I look for myself?

  • Evidence maps application:
    • site: https://phw-evidence-maps.azurewebsites.net/
    • code not currently public, sorry. We’re working on it!
  • Wedding website in Quarto:
    • site: behind a password
    • code: mini-example is at github.com/R-Walmsley/multilingual_nhsrpysoc_2024
  • I’m on GitHub as R-Walmsley (personal) and phwrwalms (work)

References